//
//  OJConnector.h
//  openJira
//
//  Created by Vincent Demay on 29/04/10.
//  Copyright 2010 Goojet. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "XMLRPC.h"
#import "OJFilter.h"
#import "OJIssue.h"
#import "OJType.h"
#import "OJStatus.h"
#import "OJComment.h"
#import "OJProject.h"

@class	OJFilterList, OJFilter, 
		OJIssue, OJIssueList, 
		OJPriority, OJPriorityList, 
		OJType, OJTypeList, 
		OJStatus, OJStatusList,
		OJComment, OJCommentList,
		OJProject, OJProjectList;

@interface OJConnector : NSObject<XMLRPCConnectionDelegate> {
	NSURL *URL;
	
	NSString *token;

	//Store priority list
	OJPriorityList	*priorityList;
	OJTypeList		*typeList;
	OJStatusList	*statusList;
	OJProjectList	*projectList;
}
@property (nonatomic, retain) OJPriorityList *priorityList;
@property (nonatomic, retain) OJTypeList *typeList;
@property (nonatomic, retain) OJStatusList *statusList;
@property (nonatomic, retain) OJProjectList *projectList;
@property (nonatomic, readonly) NSString *token;

////////////////////////////////////
+ (OJConnector*) getDefault;
////////////////////////////////////

//token is needed for each connection. This method lock HMI
- (BOOL) loginWithUser:(NSString*) user andPassword:(NSString*) password;
- (void) updatePriorities;
- (void) updateTypes;
- (void) updateStatuses;
- (void) updateProjects;

- (void) getFavouriteFilters:(OJFilterList*) filters;
- (void) getIssues:(OJIssueList*) issues fromFilter:(OJFilter *) filter;
- (void) getPriorities:(OJPriorityList*) priorities;
- (void) getTypes:(OJTypeList*) types;
- (void) getStatuses:(OJStatusList*) status;
- (void) getComments:(OJCommentList*)comments forIssue:(OJIssue*)issue;
- (void) getProjects:(OJProjectList*) projects;

- (void) addComment:(OJComment *)comment toIssue:(OJIssue*) issue;
- (void) createIssue:(OJIssue*) issue;

@end


